package com.upb.webserver.dao.mapper;

import com.upb.webserver.dao.entity.TbConfig;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import com.upb.webserver.dao.entity.TbConfigExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

public interface TbConfigMapper {

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbConfigSqlProvider.class, method = "countByExample")
    long countByExample(TbConfigExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbConfigSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbConfigExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_config", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_config (config_name, config_type, ", "config_value, create_time, ", "modify_time)", "values (#{configName,jdbcType=VARCHAR}, #{configType,jdbcType=TINYINT}, ", "#{configValue,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", "#{modifyTime,jdbcType=TIMESTAMP})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbConfig record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbConfigSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbConfig record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbConfigSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "config_name", property = "configName", jdbcType = JdbcType.VARCHAR), @Result(column = "config_type", property = "configType", jdbcType = JdbcType.TINYINT), @Result(column = "config_value", property = "configValue", jdbcType = JdbcType.VARCHAR), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    List<TbConfig> selectByExample(TbConfigExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @Select({ "select", "id, config_name, config_type, config_value, create_time, modify_time", "from tb_config", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "config_name", property = "configName", jdbcType = JdbcType.VARCHAR), @Result(column = "config_type", property = "configType", jdbcType = JdbcType.TINYINT), @Result(column = "config_value", property = "configValue", jdbcType = JdbcType.VARCHAR), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    TbConfig selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbConfigSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbConfig record, @Param("example") TbConfigExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbConfigSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbConfig record, @Param("example") TbConfigExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbConfigSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbConfig record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @Update({ "update tb_config", "set config_name = #{configName,jdbcType=VARCHAR},", "config_type = #{configType,jdbcType=TINYINT},", "config_value = #{configValue,jdbcType=VARCHAR},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "modify_time = #{modifyTime,jdbcType=TIMESTAMP}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbConfig record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_config (config_name, ", "config_type, config_value, ", "create_time, modify_time)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.configName,jdbcType=VARCHAR}, ", "#{detail.configType,jdbcType=TINYINT}, #{detail.configValue,jdbcType=VARCHAR}, ", "#{detail.createTime,jdbcType=TIMESTAMP}, #{detail.modifyTime,jdbcType=TIMESTAMP})</foreach></script>" })
    int batchInsert(List<TbConfig> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_config
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbConfigSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "config_name", property = "configName", jdbcType = JdbcType.VARCHAR), @Result(column = "config_type", property = "configType", jdbcType = JdbcType.TINYINT), @Result(column = "config_value", property = "configValue", jdbcType = JdbcType.VARCHAR), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    Optional<TbConfig> getOneByExample(TbConfigExample example);
}
